#!/bin/sh
 
usage()
{
	echo "0. clean up ./Buildit clean"
	echo "1. build 32bit program ./Buildit i386 [target in i386]"	
	echo "2. build 64bit program ./Buildit x64 [target in x64]"		
	#echo "3. build Debug program ./Buildit debug [target in Debug]"	
}

build()
{
	if [ "$*" = "clean" ] ; then
		make -f nbproject/Makefile-i386.mk QMAKE= SUBPROJECTS= .clean-conf
		make -f nbproject/Makefile-x64.mk QMAKE= SUBPROJECTS= .clean-conf
		#make -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
	elif [ "$*" = "x64" ] ; then
		make -f nbproject/Makefile-x64.mk QMAKE= SUBPROJECTS= .build-conf
	elif [ "$*" = "i386" ] ; then
	 	make -f nbproject/Makefile-i386.mk QMAKE= SUBPROJECTS= .build-conf
	elif [ "$*" = "debug" ] ; then
	 	make -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
	fi
}


if [ "$*" = "clean" -o "$*" = "x64" -o "$*" = "i386" ] ; then 
	cd ../CommonUtilitiesLib
	build $1
	
	cd ../EasyRedisClient
	build $1	

	cd ../EasyProtocol/jsoncpp
	build $1    

	cd ../EasyProtocol
	build $1
	
	cd ../../EasyDarwin
	build $1
else
	usage;
fi

